import Vue from 'vue'
import App from './App'
import store from './store/index'
import tim from './utils/commen/tim.js'
import commen from './utils/commen/commen.js'
import TIM from 'tim-js-sdk'

// main.js

// 引入uView组件库
import uView from 'uview-ui'
Vue.use(uView)

//引入svg组件
import IIcon from './components/IIcon.vue'
Vue.component('i-icon', IIcon) //全局注册 i-icon

import defaultImg from './components/defaultImg/defaultImg.vue'
Vue.component('default-img', defaultImg) //全局注册 // 页面数据为空时的默认图

//引入加载组件
import pageLoading from './components/pageLoading.vue'
Vue.component('page-loading',pageLoading)

// 引入api接口
import api from '@/api'
Vue.prototype.$api = api

//引入vuex
Vue.prototype.$store = store

//引入tim
Vue.prototype.tim = tim.tim //tim sdk 引入后生成的tim服务
Vue.prototype.$TIM = TIM //tim 的状态/事件 常量
Vue.prototype.$commen = commen

// H5复制剪切板
let Clipboard = require('./utils/clipboard')
Vue.prototype.$copyText = function(selector, cb) {
  console.log('111111111111')
  return new Promise((resolve, reject) => {
    const btnCopy = new Clipboard(selector)
    btnCopy.on('success', e => {
      uni.showToast({
        icon: 'none',
        title: '复制成功'
      })
      resolve(e)
    })
  })
}

Vue.config.productionTip = false

// #ifdef H5

// import VConsole from 'vconsole'

// const vConsole = new VConsole()
// console.log(vConsole)
// #endif
App.mpType = 'app'

const app = new Vue({
  store,
  ...App,
})
app.$mount()
